// pages/demo/demo.js
Page({

    // 3、通过aid属性获取数组中对应的项目下标findIndex
    data: {
        arr:[
            {id:1001,name:"html"},
            {id:1002,name:"css"},
            {id:1003,name:"js"}
        ]
    },
    handleDelete(event){
        // console.log(event.currentTarget.dataset)
        var {aid}=event.currentTarget.dataset;
        var arr = this.data.arr;
        var index = arr.findIndex(item=>{
            return item.id ==aid
        })
        console.log(index)
        // 4、将对应下标的数据删除splice
        arr.splice(index,1)
        console.log(arr)
        // 5、this.setData重新设置data
        this.setData({
            arr
        })
    }
    
})